home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / hackit / comp.sys.handhelds_5623_000000.msg
Internet Message Format  |  1995-03-31  |  14KB

  1. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!news.cs.indiana.edu!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!helios!tamsun.tamu.edu!ftg0673
  2. From: ftg0673@tamsun.tamu.edu (Rick Grevelle)
  3. Newsgroups: comp.sys.handhelds
  4. Subject: HP48 HACKIT Library
  5. Message-ID: <14235@helios.TAMU.EDU>
  6. Date: 6 Apr 91 07:00:46 GMT
  7. Sender: usenet@helios.TAMU.EDU
  8. Organization: Texas A&M University
  9. Lines: 270
  10.  
  11. HACKIT is a library of utilities designed to facilitate hacking in the HP48SX.
  12. While a few of these routines actually have origins that can be traced back to
  13. the HP28S, the majority of them are relatively new.  Prototypes to several of
  14. the routines have been extensively beta tested, and consequently is reflected
  15. in the material appearing here.  
  16.  
  17. A majority of these routines were written in SYSTEM RPL type fashion utilizing
  18. almost exclusively prefixed machine code to accomplish their intended results.
  19. Very little preexisting SYSTEM RPL has been utilized, and there are a few cases
  20. in which an existing prefixed machine routine could have been used in place of
  21. user written machine code, but was not.  There are multiple reasons for having
  22. done this, however the primary concern was usually to minimize execution times
  23. rather than reduce memory consumption.
  24.  
  25. There are a few individuals whose contributions and generousities have greatly
  26. affected this material, and who deserve to be recognized for their part.  I'd
  27. first like to thank Jake Schwartz for all of his ideas and countless hours of
  28. collaboration.  Equally important, thanks to Jan Brittenson for his technical
  29. support and detailed explanations of the 48's machine code.  Thanks to Robert
  30. Ellis for his hardware expertise and patience.  Also Jim Cloos for furnishing
  31. his CRC algorithm.  Last, Alonzo Gariepy, for without his help, none of these
  32. programs would have ever been possible in the first place.
  33.  
  34.  
  35. Rick Grevelle
  36.  
  37.  
  38.                 HACKIT
  39.  
  40. ==============================================================================
  41.  
  42.  
  43. Both of the machine routine algorithms found in these first two programs were
  44. originally used in similar schemes written for the 28S.  Neither algorithm is
  45. mine, and were in fact used by HP in the 28.  More recently they were utilized
  46. in the encoding schemes ->ASC, and ASC-> written by Wickes, who very well may
  47. have conceived them, considering the fact that he already has a great deal of
  48. code to his credit
  49.  
  50.  
  51.                 ->ASCI
  52.  
  53. This is a generalized binary-to-ascii conversion scheme that returns a string
  54. of hexadecimal characters which are the equivalent internal representation of
  55. the argument.  When the SYSTEM FLAG -28 is set, both the prolog and the length
  56. of code objects are truncated, meaning that the result string contains in-line
  57. machine code only.  When this flag is clear, which is the default, truncation
  58. does not occur.  All other object types are unaffected by the flag setting.
  59.  
  60.                 ASCI->
  61.  
  62. Reversing the result of the previous routine is made possible with this scheme
  63. which converts ascii-to-binary, taking as its argument a string of hexadecimal
  64. characters. When SYSTEM FLAG -29 is set, strings are treated as in-line machine
  65. code, whereby a code object would be the result.  When flag -29 is clear one of
  66. two things happens depending on the string argument itself, and is explained in
  67. the following summary.
  68.  
  69.  
  70.  
  71.                 IMPORTANT POINTS
  72.  
  73. i)   The above routines were intended to provide a means for *toggling* stack
  74.      objects back between their internal string representation and immediately
  75.      executable form, which means ROM objects must be dealt with differently.
  76.      An important attribute associated with these two schemes is their ability
  77.      to differentiate between ROM and RAM objects.
  78.  
  79. ii)  When an argument taken by the ->ASCI routine is a ROM object, a character
  80.      string representing the five nibble address where that object is located
  81.      in ROM is returned.  Strings containing only five characters that are used
  82.      as arguments for ASCI-> are treated as pointers; solitary prologs are not
  83.      permitted though.
  84.  
  85. iii) Spaces and newline carriage returns are allowed in strings that are to be
  86.      converted by ASCI->.  This helps to alleviate some of the confusion when
  87.      looking at long strings of hexadecimal characters in that spaces can now
  88.      be used to separate groups of characters, and newline carriage returns to
  89.      segment the string into several lines when editing.
  90.  
  91. iv)  Any object encoded using ->ASC can be unencoded using ASCI->.  There's no
  92.      longer a need for these silly schemes to delete newline carriage returns,
  93.      or calculate a new checksum to tack on the of an ->ASC encoded object that
  94.      has been altered in order to get ASC-> to work.  ->ASC, and ASC-> were an
  95.      effort to provide a safe means of transferring data, and not for hacking.
  96.  
  97. v)   ASCI-> performs equally well on strings of odd number lengths because the
  98.      RPL segments of the program correctly utilize the block allocate routine
  99.      at #61C1Ch.  
  100.  
  101.  
  102.  
  103.                 SCRC
  104.  
  105. Calculates the checksum on a string of hexadecimal characters as if they were
  106. in immediately executable form.  So that an object converted to its ASCII form
  107. using ->ASCI will have the same checksum when SCRC is used on the ASCII string
  108. as it would of had before it was converted using the BYTES command.  As in the
  109. ASCI-> program, spaces and newline carriage characters are ignored.
  110.  
  111.  
  112.  
  113.                 PEEK
  114.  
  115. Speed is still an essential attribute of this dual functioning PEEK.  Only the
  116. variable length version will slow slightly when large result strings hundreds
  117. of characters long are returned.  The routine is smart enough to know which of
  118. the PEEKs to implement based on the arguments it's given.  When string results
  119. are preferred, level two should contain a binary integer that's the address to
  120. be peeked, while level one should be a real number representing the length of
  121. the result string.   
  122.  
  123.  
  124.                 POKE
  125.  
  126. Complimenting PEEK is this dual functioning variable length POKE scheme which
  127. will accept either a string of hexadecimal characters, or a binary integer for
  128. the level two argument that represents the data to be poked.  Level one should
  129. be a binary integer that is the address to poke.  It is important to note that
  130. when the level two argument is a binary integer, the wordsize of that specific
  131. integer will be used to determine to determine the number of nibbles to poke,
  132. and is in no way dependent upon the current wordsize returned by RCWS.
  133.  
  134.  
  135.  
  136.                 OUT->
  137.  
  138. Multifunctioning OUT-> encompasses several of the objects on which OBJ-> will
  139. not work.  ALG->, and PRG-> are analogous to LIST->, only they are intended to
  140. function on algebraics and programs rather than lists; OUT-> functions on all
  141. three of these.  XLIB-> has also been included here; it decomposes visible and
  142. hidden XLIBs into their library and command numbers.  ARR-> was also included
  143. here; it functions identically to ARRY->, but will work on an array of any type
  144. including strings, algebraics, lists, etc.
  145.  
  146.  
  147.                 ->ALG
  148.  
  149. Be careful with this one; the stack arguments must be in strict RPN order.  As
  150. before, ->ALG is analogous to ->LIST, only the result is an algebraic, rather
  151. than a list.
  152.  
  153.  
  154.                 ->ARR
  155.  
  156. This is my version of ->ARRY; it will build an array of any kind providing all
  157. stack arguments are of the same type. (i.e. strings, reals, algebraics, etc.)
  158. It functions identically to ->ARRY, except that real and complex numbers can't
  159. be mixed.  Level one can be either a real number, a list containing a real, or
  160. a list containing two reals.
  161.  
  162.  
  163.                 ->DIR
  164.  
  165. Builds a directory from the stack on the stack.  Level one must contain a real
  166. which is the total number of variables that the directory is to contain, level
  167. two a global name, and level three the contents of that global name.  Because
  168. the entire process utilizes dynamic RAM, it is relatively fast for moderately
  169. sized directories, but slows substantially on very large ones.
  170.  
  171.  
  172.  
  173.                 ->PRG
  174.  
  175. Functions identically to ->LIST, only the result is a program, and not a list.
  176.  
  177.  
  178.                 ->XLIB
  179.  
  180. Builds an XLIB from two stack arguments.  Level two can be either a real number
  181. or a binary integer that's the number of the library to which the XLIB belongs.
  182. Level one must be the same argument type as level two and should be the command
  183. number of the desired XLIB.  
  184.  
  185.  
  186.                 RCLDR
  187.  
  188. Recalls the current directory to the stack in exploded format, after which the
  189. ->DIR scheme could be used to pack the stack results back up into a directory.
  190.  
  191.  
  192.                 RCLIB
  193.  
  194. This multifunctional routine is to a library what RCL is to a directory.  RCLIB
  195. will recall a library as a fully operational directory.  All that is necessary
  196. to do is to put either the library's name or (real) number in level one.  Again
  197. this is slowed greatly on very large libraries.  RCLIB will work on any library
  198. including ROM (i.e. 2, 240, 1792).  Finally, the contents of any library's XLIB
  199. can be recalled to the stack; simply put the appropriate XLIB in level one, and
  200. the result will be comparable to using RCL on variable stored in a directory.
  201.  
  202.  
  203.  
  204. O  /
  205.  \/ 
  206.  /\ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  207. O  \
  208.  
  209.  
  210. %%HP: T(1)A(D)F(.);
  211. "04B201611060841434B4944560EB40EF0000000E5F00C00008EB4E00D9D20119
  212. 20EB40090770B21308EB4F00D9D2088130F128039916B9F06CCC804E76132230
  213. 4E7614525639150493262B1614932651B50B21308EB4010D9D20FA450881303C
  214. 37052330AD2A1A2170D9D2029E20EB43108A126CB91629E20EB4F00B21309427
  215. 043370D6450B21308EB4110D9D20FA450881303C37052330AD2A1A2170D9D202
  216. 9E20EB43108A126CB91629E20EB4F00B2130942704337095450B21308EB4210D
  217. 9D20FA450881303C37052330AD2A1A2170D9D2029E20EB43108A126CB91629E2
  218. 0EB4F00B2130942704337054450B21308EB4310D9D207E1263991629E20EB421
  219. 0112263991629E20EB41102D1263991629E20EB4010B21308EB4410D9D205D55
  220. 0D0040C1C16CAF06FEF30083162A170E342405E70D9D2088130F1280399169EB
  221. 5088130CCC804E761322304E7614525639150493262B16149326B21304B25639
  222. 15051B503223099E70EE170D9D20AD2A18DA16D9D209AF168DA1667E7075660B
  223. 213029E20EB4310EF116FED30F6E30D2E300831635316E9330FED30CA130B213
  224. 05E17062726F6E30FED30954506AE42B2130CCD20CC0008F146608FB9760D814
  225. 7C2134168174147C4C21C413717706D2305D7CD14B31A0962A43102962143114
  226. 9EED13103B6A4A531909E61515006910B6A31509E6D330AA0A1500180E71C1CD
  227. 56A183DB14418434CCD20144071361448D341508F2D7608DB8F018EB4D00D9D2
  228. 05AA812BF819FF30D9D20AEC81881309C080A2170650115B826A21706501129E
  229. 20EB4410B2130B2040D9D20F4180A2170650118813029E20EB4410B213058040
  230. D9D2099E70B3A1661050B2130B21308EB4C00D9D20E1A81D9D20FEF30A5D8012
  231. 681DA916FBD812A170E3424881303E28059230FED30EF116A36812FA308C170F
  232. BD81B2130B21308EB4B00D9D20FDE8199040D9D20AEC8132230AEC813223005E
  233. 70B2130ECD46D9D201D3F405E70B2130B21308EB4A00D9D2043C8154450B2130
  234. 8EB4900D9D20ECE819FF30D9D20AEC818A816D9D2041E8091870B2130F6E30C4
  235. 1302C23038D30A21702CC81FEF3032230BD3708131605391A2170D9D209AF168
  236. DA1667E7075660B2130122703F21653026A21702BC819EB504B2563915051B50
  237. 3223012270FED30300405A3705D550D0040C1C162C23056316FED30954506AE4
  238. 2B2130B21308EB4800D9D205AA81D9D202BF819FF30DEE3212040D9D209BC260
  239. 3FD16B436B2130FEF302BC81B2130AD3911E136353369B191C41302C230FED30
  240. 38D30A21702CC81CCD20F71008F146608FB97601001438FC1830DB10A3441000
  241. CBC7C7C3174147137143135104118CE45506143130D814211C8A2018F2D7608D
  242. 7BC818F91030184136E9C35908D066501740757B8FC455011B5F013706DB10B8
  243. 4A8F8DA604ED136109135348E92014517411B13418413614517411C14517411A
  244. 145D71B97507142130142130174CF4F08F878301455DE118D707CF4331341841
  245. 4213606D81308F91030184D9136E91648FC07605AC8F2D760118C3DAC6C6C213
  246. 3CA1311191458D94150B21308EB4700D9D2043C81D6450B21308EB4600D9D20E
  247. CE8171040D9D20BCB73122702C230D1730C0726433709A53092591B213012040
  248. 379C1F3040379C194040379C158040D9D20CCC80FBD8132230FBD8132230B213
  249. 0B21308EB4500D9D2008A81D9D202BF818AB46D9D2030A50322305D550226500
  250. 8316C1C16322308A81668F0129E20EB4510B4826B2130ECD46D9D2030A50B213
  251. 0FEF302BC81B21302C23061650CCD20130008FD5F30068FB9760147134169131
  252. 078FC07608D3415044230B21308EB4400D9D20ECE81D5040D9D2075660CCD20A
  253. 4000132100147134164146818FA580D0164D2156113615211341501201101321
  254. 42164808CB21309FF30D9D202BF814CD46D9D20AEC81FD5502C230F6E30C1C16
  255. 5923030A5059230CCD20A50008FD5F30068FB976014713416913107CED5AE015
  256. B03103A6A31939EA903170A6A148161170CD56D8D34150B2130B2130B21308EB
  257. 4300D9D20FDE81ECD46D9D2030A50CCD20570008F146608FB976014713416A15
  258. 67AF51801564130152780DF91052160BF4B4651F80CF0D40E910BDBF41605FE1
  259. 32E4248FC2245142164808CB2130B21308EB4200D9D20ECE81D0040D9D208813
  260. 0636508A81644230CCD206E0008F146608FB9760D8143131179D0100CDD014B3
  261. 1A0962E631029625631149EE913103B6A4D631909E6466510B6A31509E64530A
  262. A0A7650D230F0EF2D7331801D0CF480CA68FF118F61087C20100171CD508238F
  263. F2245142164808C8F2D7608DB8F01101FC1180EF6121FE0EF21110EFE0132230
  264. 63650FBD81ED2A2EF9A2B2130B21308EB4100D9D20ECE81D0040D9D205D55022
  265. 65008316C1C16322308A816852301114048735A2170D9D20881307104038D30A
  266. 217068F0166F6088130616507104038D30A217068F0130040C9B26AD2A1B3A16
  267. 75660B213029E20EB4510B9F06B2130B21308EB4000D9D205AA81D9D20701404
  268. 873508316CB916D9D20D9F8161DC138E51FEF30D9D200CA30E0F06B2130B2130
  269. 32230A2170D9D20AD2A18DA16D9D20FD55035040C1C1612040CCD20720008F14
  270. 6608FB9760CCD81431301691746E50B2130D9D208813020950FD5502C230F6E3
  271. 0C1C1632230CCD20C50008F146608FB9760CCD8143130169174143131AE015B0
  272. 3103A6A31939EA903170A6A148161170CD56D8D34150B2130B9F06B2130B2130
  273. B2130E4A2037000C9EFF1DDFFF8CFF6EBFFEBAFF5E9FFD49FFD29FFB17FFB06F
  274. FBE5FFF85FFA15FFC64FF360FFE70FF0D0FF331FF691FF9F1FF442FFC63FFE4A
  275. 2006100000000000000000640006B00000000000000000000000000000000000
  276. 000000000000000000000005C000403534253420040355454B430040055454B4
  277. 4004005F4B45450040F45545D860040D814C47470040D814252580040D844942
  278. 590040D8052574A0050D8143534940005014353494D810050D885C49424B0050
  279. 2534C44425C00502534C49424D00B400014000AC0002C000AB0002B000AA0002
  280. A000A900029000A800046000A500005000582C57AF"
  281.